package hcn.sync.annotation.status;


/**
 * Created by chase on 2016/10/24.
 */
public enum StatusType {
    STATUS_UNSTART("00", "未启动"), STATUS_START("01", "已启动"), STATUS_RUNNING("02", "正在运行"), STATUS_FINISHED("03", "完成"),
    STATUS_PAUSE("04", "暂停"), STATUS_STOP("05", "已停止"), STATUS_BLOCKED("06", "堵塞"), STATUS_ERROR("09", "运行出错");
    private String code;
    private String display;

    StatusType(String code, String display) {
        this.code = code;
        this.display = display;
    }

    public String getCode() {
        return code;
    }

    public String getDisplay() {
        return display;
    }

    public static StatusType get(String code) {
        for (StatusType cardType : values()) {
            if (cardType.getCode().equals(code)) {
                return cardType;
            }
        }
        return null;
    }

    public static String getDisplay(String code) {
        StatusType statusType = get(code);
        return statusType == null ? "" : statusType.getDisplay();
    }
}